public class args {
    public static void main(String[] args) {
        // 可变参数
        getSum(new int[]{1, 2, 3, 4});

    }
    public  static int getSum(int... args){
//        System.out.println( args);
        int a = 0;
        for (int i = 0; i < args.length-1; i++) {
//            System.out.println(args[i]);
            a+=args[i];
        }
        System.out.println(a);
        return a;
    }
}
